<template>
	<view>
		<view class="smart-page-head">
			<view class="smart-page-head-title">text文本</view>
		</view>
		<view class="smart-padding-wrap">
			<view class="text-box" scroll-y="true">
			<text>{{ text }}</text></view>
		</view>
		<button type="primary" @click="add" :disabled="!canAdd">add line</button>
		<button type="default" @click="remove" :disabled="!canRemove">remove line</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				texts:[
					'111'

				],
				text:'',
				canAdd: true,
				canRemove:false,
				extraLine:[]
			};
		},
		methods: {
			add: function(e){
				this.extraLine.push(this.texts[this.extraLine.length % 12]);
				this.text = this.extraLine.join('\n');
				this.canAdd = this.extraLine.length < 12;
				this.canRemove = this.extraLine.length > 0;
			},
			remove: function(e) {
				if (this.extraLine.length > 0){
					this.extraLine.pop();
					this.text = this.extraLine.join('\n');
					this.canAdd = this.extraLine.length < 12;
					this.canRemove = this.extraLine.length >0;
				}
			}
		}
	};
</script>

<style>

</style>
